(function(){
  var global = this;
  typeof Act == "undefined" && (global.Act = {})
  Act.global = global;
  Act.Componet = new Ext.util.Observable;
  Config = Ext.apply(Act.config, {
    Buttons: {
      "添加": "ButtonAdd",
      "修改": "ButtonModify",
      "删除": "ButtonDelete"
    }
  });
  Act.prompt = Promt = {
    title: '提示'
  },
  Act.msg = Msg = {
    Normal: function(msg, fn, width, icon, scope) {
      return Ext.Msg.show({
        title: Act.prompt.title,
        msg: msg,
        width: width || null,
        buttons: Ext.Msg.OK,
        icon: icon || Ext.Msg.INFO,
        closabe: !1,
        fn: fn,
        scope: scope
      })
    },
    Error: function(msg, fn, width, scope){
      this.Normal(msg, fn, width, Ext.Msg.ERROR, scope);
    },
    Question: function(msg, fn, width, scope) {
      this.Normal(msg, fn, width, Ext.Msg.WARNING, scope)
    },
    Confirm: function(msg, fn, width, icon, buttons, scope) {
      return Ext.Msg.show({
          title: Snmon.prompt.title,
          msg: msg,
          width: width || null,
          fn: fn,
          buttons: buttons || Ext.Msg.OKCANCEL,
          icon: icon || Ext.Msg.INFO,
          closable: !1,
          scope: scope
      })
    },
    Failure: function(msg) {
    }
  },
  Act.ctype = {
    "文本控件": "Text",
    "区域控件": "TextArea",
    "数值控件": "Number",
    "日期控件": "Date",
    "时间控件": "Time",
    "查询控件": "Query",
    "下拉控件": "ComboBox",
    "复选控件": "Checkbox"
  }


  Act.AddTab = function(id, title, url){
    var tab = Act.mainTab.getComponent(id);
    if(!tab){
      tab = Ext.create("Ext.panel.Panel", {
        id: id,
        title: title,
        pageName: "页面管理",
        layout: "border",
        closable: id != 'home',
        loader: {
          autoLoad: !0,
          url: url,
          loadMask: !0,
          scripts: !0,
          scope: this,
        }
      })
      tab = Act.mainTab.add(tab);
    }
    Act.mainTab.setActiveTab(tab);
  }

  // Ext Libs
  Ext.define('Act.lib.ButtonTransparent', {
    extend : 'Ext.button.Button',
    alias : 'widget.buttontransparent',
    initComponent : function() {
      if ( (!Ext.isIE) && Ext.themeName === 'neptune') {
        this.listeners = {
          // 鼠标移开，背景设置透明
          mouseout : function() {
            this.setTransparent(document.getElementById(this.id));
          },
          // 鼠标移过，背景取消透明
          mouseover : function() {
            var b = document.getElementById(this.id);
            b.style.backgroundImage = '';
            b.style.backgroundColor = '';
            b.style.borderColor = '';
          },
          // 背景设置透明
          afterrender : function() {
            this.setTransparent(document.getElementById(this.id));
          }
        }
      }
      this.callParent(arguments);
    },

    setTransparent : function(b) {
      b.style.backgroundImage = 'inherit';
      b.style.backgroundColor = 'inherit';
      b.style.borderColor = 'transparent';
    }
  })


})()